home *** CD-ROM | disk | FTP | other *** search
-
- // (c) 1996 Dieter Spaar
- // Internet: spaar@mirider.augusta.de
-
- // Wrapper to install assembler shutdown routine
- // The patch for SCSIDispatch is executed just before volumes are unmounted
-
- #include <Quickdraw.h>
- #include <Events.h>
- #include <Traps.h>
- #include <Windows.h>
- #include <Dialogs.h>
- #include <Controls.h>
- #include <Menus.h>
- #include <TextEdit.h>
- #include <Memory.h>
- #include <Desk.h>
- #include <Fonts.h>
- #include <ToolUtils.h>
- #include <Files.h>
- #include <Shutdown.h>
-
- // DLOG
-
- #define About 128
- #define Splash 129
-
- extern pascal long GetSize(void);
- extern pascal Ptr GetAddr(void);
-
- void ShowSplashDialog(void)
- {
- GrafPtr savePort;
- DialogPtr theDialog;
- long time;
-
- GetPort(&savePort);
- theDialog = GetNewDialog(Splash, nil, (WindowPtr) -1);
- SetPort(theDialog);
-
- DrawDialog(theDialog);
-
- time = TickCount();
- do
- {
- SystemTask();
- } while (TickCount() - time < 120L);
-
- DisposDialog(theDialog);
- SetPort(savePort);
- }
-
- // install shutdown routine in system heap
-
- void InstallPatch(void)
- {
- long size;
- Ptr patchSysPtr;
-
- size = GetSize();
-
- SetZone(SystemZone());
- patchSysPtr = NewPtr(size);
- SetZone(ApplicZone());
-
- if( patchSysPtr == nil )
- {
- SysBeep(60); // very simple error handling ;-)
- return;
- }
-
- BlockMove(GetAddr(), patchSysPtr, size);
-
- ShutDwnInstall((ShutDwnUPP)patchSysPtr, sdOnUnmount);
- }
-
-
- main()
- {
- // initialisation
-
- MaxApplZone();
- InitGraf(&qd.thePort);
- InitFonts();
- FlushEvents(everyEvent, 0);
- InitWindows();
- InitMenus();
- TEInit();
- InitDialogs(nil);
- InitCursor();
-
- #if 0 // alert instead of splash screen
- if( NoteAlert(About, nil) == 1)
- InstallPatch();
- #else
- ShowSplashDialog();
- InstallPatch();
- #endif
- }
-